# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all                                                                   # include all helpers, all the time
  protect_from_forgery                                                          # See ActionController::RequestForgeryProtection for details

  #通过开始时间和结束时间，得到持续的分钟数
  def getDuringMinute begin_time,finish_time                                  #根据小时数来猜测是哪一天
    beginHour = begin_time[11, 2]
    beginMinute = begin_time[14, 2]
    if beginHour.to_i<10                                                        #如果大于10点，那就就是指当天。如果小于10点，就是第二天
      beginHour = beginHour.to_i + 24                                           #第二天就相当于当前点数加上24小时
    end
    beginAll= beginHour.to_i*60 + beginMinute.to_i
    finishHour = finish_time[11, 2]
    finishMinute = finish_time[14, 2]
    if finishHour.to_i<10
      finishHour = finishHour.to_i + 24
    end
    finishAll= finishHour.to_i*60 + finishMinute.to_i
    return finishAll.to_i - beginAll.to_i
  end
  
  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password
  #用来显示当前调用的controller和action

  def sys_before_log
    logger.info "---------------------controller:"+params[:controller]+",action:"+params[:action]+"----------------From sys_before_log Begin"
    logger.info params
  end

end
